package ch.jamme.model.rel1;

import java.util.*;

import ch.jamme.model.*;

public class Shop extends AbstractDomainObject{
	
	private String name;
	
	private List<Order> orders = new ArrayList<Order>();

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public List<Order> getOrders() {
		return orders;
	}

	public void setOrders(List<Order> orders) {
		this.orders = orders;
	}
	
	public String getHumanReadableDescription() {
		return "Shop "+getName();
	}
	
	public void buy (Customer customer, ItemImpl item) {
		Order order = new Order();
		List<OrderLine> orderLines = new ArrayList<OrderLine>();
		OrderLine orderLine = new OrderLine();
		orderLine.setItem(item);
		orderLine.setQuantity(1);
		orderLine.setLineNr(1);
		orderLines.add(orderLine);
		order.setOrderLines(new OrderLine[] { orderLine } );
		List<Order> orders = new ArrayList<Order>();
		customer.setOrders(orders);
	}

}
